<template>
  <div class="flex_col">
    <div>
      <van-swipe class="my-swipe"
                 indicator-color="white"
                 :loop="false">
        <van-swipe-item class="flex_row">
          <!-- 第一块 -->
          <div class="flex1 flex_col pdt20"
               style="margin-left: 8%">
            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div>
                <label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label>
              </div>
            </div>

            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div>
                <label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label>
              </div>
            </div>
          </div>

          <!-- 第二块 -->
          <div class="flex1 flex_col pdt20">
            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div>
                <label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label>
              </div>
            </div>

            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div>
                <label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label>
              </div>
            </div>
          </div>
        </van-swipe-item>
        <van-swipe-item>2</van-swipe-item>
        <van-swipe-item>3</van-swipe-item>
        <van-swipe-item>4</van-swipe-item>
      </van-swipe>
    </div>
    <!-- echart图 -->
    <div id="maindlkf1"></div>
  </div>
</template>
<script>
import Vue from "vue";
import { Swipe, SwipeItem } from "vant";
// import echarts from 'echarts'
Vue.use(Swipe).use(SwipeItem);
export default {
  name: "dlkf",
  props: {
    echarts: {
      type: Object,
      default: null,
    },
  },

  data () {
    return {
      charts: null,
    };
  },

  methods: {
    drawPies (id) {
      console.log('执行了dlkf的方法')
      // this.echarts.init(document.getElementById(id)).dispose();
      this.charts = this.echarts.init(document.getElementById(id));
      // 绘制图表
      this.charts.setOption({
        title: { text: "世界人口总量" },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        legend: {
          data: ["2011年", "2012年"],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "value",
          boundaryGap: [0, 0.01],
        },
        yAxis: {
          type: "category",
          data: ["巴西", "印尼", "美国", "印度", "中国", "世界人口(万)"],
        },
        series: [
          {
            name: "2011年",
            type: "bar",
            data: [18203, 23489, 29034, 104970, 131744, 630230],
          },
          {
            name: "2012年",
            type: "bar",
            data: [19325, 23438, 31000, 121594, 134141, 681807],
          },
        ],
      });
    },
  },
  mounted () {
    // this.$nextTick(function () {
    //   this.drawPies("maindlkf1");
    // });
  },
  destroyed () {
  },
};
</script>

<style lang="less" scoped>
.my-swipe .van-swipe-item {
  height: 280px;
  background: url("../../assets/images/swipebg.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.block1 {
  width: 85%;
  height: 100px;
  margin-top: 10px;
  background: #ffffff;
  box-shadow: 0 4px 6px 0 rgba(22, 45, 113, 0.1);
  border-radius: 4px;
  border-radius: 4px;
  .blockt1 {
    margin-top: 17px;
    margin-left: 15px;
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #999999;
    letter-spacing: 0;
  }
  .blockt2 {
    margin-left: 15px;
    font-family: DINCond-Black;
    font-size: 28px;
    font-weight: bold;
    color: #333333;
    letter-spacing: 0.7px;
  }
  .blockt3 {
    margin-left: 15px;
    margin-top: 5px;
    font-family: PingFangSC-Regular;
    font-size: 10px;
    color: #357fff;
  }
  .blockt4 {
    margin-top: 5px;
    margin-left: 5px;
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #ff6a6a;
  }
}
// #maindlkf1 {
//   width: 80%;
//   height: 450px;
//   margin: 50px auto;
//   border: 1px solid #ddd;
// }
</style>
